<template>
  <div class="title">
    <div v-if="isShow">
      <div class="line"></div>
      <span>{{ name }}</span>
    </div>
    <div v-if="!isShow">
      <div class="line"></div>
      <span>全部分类</span>
    </div>
  </div>
</template>

<script>
export default {
  props: ["name"],
  data() {
    return {
      isShow: false,
    }
  },
  created() {
    setTimeout(() => {
      this.isShow = true
    }, 150)
  },
}
</script>

<style lang="less" scoped>
.title {
  background-color: #fff;
  margin-bottom: 10px;
  text-align: center;
  height: 50px;
  line-height: 50px;
  position: relative;
  box-sizing: border-box;
  .line {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    margin: auto;
    width: 40%;
    height: 3px;
    background-color: #cccc;
  }
  span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    overflow: hidden;
    padding: 0 15px;
    background-color: #fff;
  }
}
</style>
